﻿using ET.DBCommon.Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ET.DBCommon.DAL
{
    public class OperateitemDAL
    {
        /// <summary>
        /// 获取操作步骤内容
        /// </summary>
        /// <param name="stepDesc">操作步骤描述</param>
        /// <returns></returns>
        public static List<Operateitem> OperateitemList()
        {
            string sql = "select * from operateitem";
            DataSet ds = DbHelper.ExecuteDataset(sql);
            List<Operateitem> lst = new List<Operateitem>();
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                DataTable dt = ds.Tables[0];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Operateitem info = new Operateitem();
                    info.Id = Convert.ToInt32(dt.Rows[i]["Id"]);
                    info.Describes = dt.Rows[i]["Describes"].ToString();

                    lst.Add(info);
                }
            }
            return lst;
        }
        public static List<Operateitem> OperateitemList(string sql)
        {
            
            DataSet ds = DbHelper.ExecuteDataset(sql);
            List<Operateitem> lst = new List<Operateitem>();
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                DataTable dt = ds.Tables[0];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Operateitem info = new Operateitem();
                    info.Id = Convert.ToInt32(dt.Rows[i]["Id"]);
                    info.Describes = dt.Rows[i]["Describes"].ToString();

                    lst.Add(info);
                }
            }
            return lst;
        }
    }
}
